package net.basshista.jsshtunneling.ui;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JTextField;

public class JNumberField extends JTextField {

    /**
     * 
     */
    private static final long serialVersionUID = 8043688189295855208L;

    private class Key implements KeyListener {

	@Override
	public void keyTyped(KeyEvent e) {
	    if (!Character.isDigit(e.getKeyChar())) {
		e.consume();
	    }

	}

	@Override
	public void keyPressed(KeyEvent e) {
	}

	@Override
	public void keyReleased(KeyEvent e) {
	}

    }

    public JNumberField() {
	this.addKeyListener(new Key());
    }

}